import 'package:cbec_app/generated/json/base/json_convert_content.dart';
import 'package:cbec_app/entity/home/content/notice_entity.dart';
import 'package:cbec_app/entity/home/content/content_data.dart';

NoticeEntity $NoticeEntityFromJson(Map<String, dynamic> json) {
  final NoticeEntity noticeEntity = NoticeEntity();
  final String? bgColor = jsonConvert.convert<String>(json['bg_color']);
  if (bgColor != null) {
    noticeEntity.bgColor = bgColor;
  }
  final int? pageMargin = jsonConvert.convert<int>(json['page_margin']);
  if (pageMargin != null) {
    noticeEntity.pageMargin = pageMargin;
  }
  final String? color = jsonConvert.convert<String>(json['color']);
  if (color != null) {
    noticeEntity.color = color;
  }
  final String? cardBgColor = jsonConvert.convert<String>(json['card_bg_color']);
  if (cardBgColor != null) {
    noticeEntity.cardBgColor = cardBgColor;
  }
  final int? cardVerticalPadding = jsonConvert.convert<int>(json['card_vertical_padding']);
  if (cardVerticalPadding != null) {
    noticeEntity.cardVerticalPadding = cardVerticalPadding;
  }
  final int? cardBorderRadius = jsonConvert.convert<int>(json['card_border_radius']);
  if (cardBorderRadius != null) {
    noticeEntity.cardBorderRadius = cardBorderRadius;
  }
  final String? uuid = jsonConvert.convert<String>(json['uuid']);
  if (uuid != null) {
    noticeEntity.uuid = uuid;
  }
  final String? content = jsonConvert.convert<String>(json['content']);
  if (content != null) {
    noticeEntity.content = content;
  }
  return noticeEntity;
}

Map<String, dynamic> $NoticeEntityToJson(NoticeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['bg_color'] = entity.bgColor;
  data['page_margin'] = entity.pageMargin;
  data['color'] = entity.color;
  data['card_bg_color'] = entity.cardBgColor;
  data['card_vertical_padding'] = entity.cardVerticalPadding;
  data['card_border_radius'] = entity.cardBorderRadius;
  data['uuid'] = entity.uuid;
  data['content'] = entity.content;
  return data;
}

extension NoticeEntityExtension on NoticeEntity {
  NoticeEntity copyWith({
    String? bgColor,
    int? pageMargin,
    String? color,
    String? cardBgColor,
    int? cardVerticalPadding,
    int? cardBorderRadius,
    String? uuid,
    String? content,
  }) {
    return NoticeEntity()
      ..bgColor = bgColor ?? this.bgColor
      ..pageMargin = pageMargin ?? this.pageMargin
      ..color = color ?? this.color
      ..cardBgColor = cardBgColor ?? this.cardBgColor
      ..cardVerticalPadding = cardVerticalPadding ?? this.cardVerticalPadding
      ..cardBorderRadius = cardBorderRadius ?? this.cardBorderRadius
      ..uuid = uuid ?? this.uuid
      ..content = content ?? this.content;
  }
}
